package com.jqb.jnid.filesys;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;



public class JndiFilesysLookup {

	public static void main(String[] args) {
		try {
			
			Properties prop = new Properties();
			prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
			prop.put(Context.PROVIDER_URL, "file:JNDIROOT");
			Context ctx = new InitialContext(prop);
			Baidu bd = (Baidu) ctx.lookup("www.baidu.com");
			String ip = bd.getIp();
			String admin = bd.getAdmin();
			System.out.println("IP:" + ip+"  admin:"+admin);
			ctx.close();
			
		} catch (NamingException e) {
			e.printStackTrace();
		}
	}
}
